using ReflectionStudio.Core.Events;
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
using System.Windows;
using WPFExcelReport.Helpers;
using System.Data;
namespace WPFExcelReport
{
    using zl_bool = System.Int32;
    using zl_u16 = System.UInt16;
    using zl_u8 = Byte;
    using ZLDevHandler = System.UInt32;
    public class StateObject
    {
        // Client socket. 
        public Socket workSocket = null;
        // Size of receive buffer. 
        public const int BufferSize = 256;
        // Receive buffer. 
        public byte[] buffer = new byte[BufferSize];
        // Received data string. 
        public StringBuilder sb = new StringBuilder();
    }
    public struct CommandQ
    {
        public string ip;
        public string command;
        public object ADDRESS;
        public object count;
        public object SlaveID;
        public object Channel;
        public int INTERVAL;
        public string MSETID;
        public string devtyp;
        public string BDEKEN;
        public object DataSend;
    }
    public partial class VICC_ZLAN
    { 
         
        VAMSTAMM _VAM;
        public VAMSTAMM VAM
        {
            get
            {
                if(_VAM==null)
                {
                    _VAM = new VAMSTAMM();
                }
                return _VAM;
            }
        }
        private VAMVALUE _VAMV;
        public VAMVALUE VAMV
        {
            get
            {
                if (_VAMV == null)
                {
                    _VAMV = new VAMVALUE();
                }
                return _VAMV;
            }
        }
        private VABPOS _ABP;
        public VABPOS ABP
        {
            get
            {
                if (_ABP == null)
                {
                    _ABP = new VABPOS();
                }
                return _ABP;
            }
        }
        public SDevParam COPYDEV(SDevParam dev)
        {
            SDevParam nDev = new SDevParam();
            nDev.IPMode = dev.IPMode;
            nDev.DevName = dev.DevName;
            nDev.DestName = dev.DestName;
            nDev.LocalIP = dev.LocalIP;
            nDev.NetMask = dev.NetMask;
            nDev.GateWay = dev.GateWay;
            nDev.DnsServerIP = dev.DnsServerIP;
            nDev.UDPGroupIP = dev.UDPGroupIP;
            nDev.ResourceIP = dev.ResourceIP;
            nDev.WorkMode = dev.WorkMode;
            nDev.LocalPort = dev.LocalPort;
            nDev.DestMode = dev.DestMode;
            nDev.DestPort = dev.DestPort;
            nDev.BaudrateIndex = dev.BaudrateIndex;
            nDev.Parity = dev.Parity;
            nDev.DataBits = dev.DataBits;
            nDev.StopBits = dev.StopBits;
            nDev.FlowControl = dev.FlowControl;
            nDev.MaxPacketLen = dev.MaxPacketLen;
            nDev.MaxTimeGap = dev.MaxTimeGap;
            nDev.AppProtocol = dev.AppProtocol;
            nDev.ReconnectTime = dev.ReconnectTime;
            nDev.KeepAliveTime = dev.KeepAliveTime;
            nDev.WebPort = dev.WebPort;
            nDev.status = dev.status;

            nDev.ResourcePort = dev.ResourcePort;
            nDev.Ver = dev.Ver;
            nDev.FuncSel = dev.FuncSel;
            nDev.FuncSel2 = dev.FuncSel2;
            nDev.DevID = dev.DevID;
            nDev.IO = dev.IO;
            nDev.FuncEn = dev.FuncEn;
            nDev.ServerModeParamT = dev.ServerModeParamT;
            return nDev;

        }
        public string NEWZLANDEV(ZLDevHandler hDEV, SDevParam dev)
        {
            string mac = "";
            dwData = TBMain.NewRow();
            SetUpNewRow(ref dwData);
            dwData["MANDANT"] = "00";
            dwData["HDEV"] = hDEV;
            dwData["IPMODE"] = dev.IPMode;
            dwData["DEVNAME"] = Helper.CHAR2STR(dev.DevName);
            dwData["SERVRENAME"] = Helper.CHAR2STR(dev.DestName);
            dwData["LOCALIP"] = Helper.IntToIp(dev.LocalIP);
            dwData["NETMASK"] = Helper.IntToIp(dev.NetMask);
            dwData["GATEWAY"] = Helper.IntToIp(dev.GateWay);
            dwData["DNSSERVERIP"] = Helper.IntToIp(dev.DnsServerIP);
            dwData["UDPGROUPIP"] = Helper.IntToIp(dev.UDPGroupIP);
            dwData["RESOURCEIP"] = Helper.IntToIp(dev.ResourceIP);
            dwData["WORKMODE"] = dev.WorkMode;
            dwData["LOCALPORT"] = dev.LocalPort;
            dwData["WORKMODE"] = dev.DestMode;
            dwData["SERVERPORT"] = dev.DestPort;
            dwData["BAUDRATEINDEX"] = dev.BaudrateIndex;
            dwData["PARITY"] = dev.Parity;
            dwData["DATABITS"] = dev.DataBits;
            dwData["STOPBITS"] = dev.StopBits;
            dwData["FLOWCONTROL"] = dev.FlowControl;
            dwData["MAXPACKETLEN"] = dev.MaxPacketLen;
            dwData["MAXTIMEGAP"] = dev.MaxTimeGap;
            dwData["APPPROTOCOL"] = dev.AppProtocol;
            dwData["RECONNECTTIME"] = dev.ReconnectTime;
            dwData["KEEPALIVETIME"] = dev.KeepAliveTime;
            dwData["WEBPORT"] = dev.WebPort;
            dwData["STATUS"] = dev.status;

            dwData["RESOURCEPORT"] = dev.ResourcePort;
            dwData["VER"] = dev.Ver;
            dwData["FUNCSEL"] = dev.FuncSel;
            dwData["FUNCSEL2"] = dev.FuncSel2;

            mac = Helper.CHAR2MAC(dev.DevID);
            dwData["DEVID"] = Helper.CHAR2MAC(dev.DevID);
            dwData["IO"] = dev.IO;
            dwData["FUNCEN"] = dev.FuncEn;
            dwData["SERVERMODEPARAMT"] = dev.ServerModeParamT;
            TBMain.Rows.InsertAt(dwData, 0);
            SResult = QICC_ZLAN02(dwData);
            {
                if (SResult.Tables[0].Rows.Count > 0)
                {
                    UZLAN01(dwData);
                }
                else
                {
                    dwData["ABAID"] = Helpers.Helper.GetSubRollNum(VSDDAT.SD22.GETNEXT("0022", "ZLANID", "  ", 1));

                    InsertICC_ZLAN(dwData);
                }
            }
            return mac;

        }
        public void SETUPPLC(zl_u16 m_Count)
        {
            for (int i = 0; i < m_Count; i++)
            {
                //GETZLANV2(System.Convert.ToByte(i));
            }
        }
        Dictionary<object, object> ZLPLC = new Dictionary<object, object>();
        ZLDevHandler[] hDevs = new ZLDevHandler[256];
        int ZLANCount = 0;
        public void SETZLANV1()
        {
            UInt16 hDevSize = 256 * 2;
            ZLANCount = ZLAN.StartSearchDev(hDevs, hDevSize);
        }
        public void GETZLANP()
        {
            try
            {
                SDevParam pParam;
                zl_bool zlbl = -1;
                ZLDevHandler hDev = 0;
                ZLPLC.Clear();
                TBMain.Clear();
                UInt16 hDevSize = 256 * 2;
                ZLANCount = ZLAN.StartSearchDev(hDevs, hDevSize);
                for (int i = 0; i < ZLANCount; i++)
                {
                    pParam = new SDevParam();
                    hDev = hDevs[i];
                    zlbl = ZLAN.GetDevParam(hDev, ref pParam);
                    string mac = NEWZLANDEV(hDev, pParam);
                    ZLPLC.Add(mac, pParam);
                }
                TBMain.AcceptChanges();
            }
            catch (Exception ex)
            {
                Helpers.LogHelper.error(ex.StackTrace+ex.Message); 
                MessageBox.Show(ex.Message);
            }
        }
        public unsafe void GETZLANV2(zl_u8 hDEV)
        {
            string mac = "";
            zl_u8* maca = ZLAN2.GetDevID(hDEV);
            //dwData["DEVID"] = maca;
            //filter = "DEVID='" + maca + "'";
            rows = TBMain.Select(filter);
            if (rows.Length == 0)
                return;
            dwData = rows[0];
            dwData["MANDANT"] = "00";
            dwData["IPMODE"] = ZLAN2.GetIPMode(hDEV);
            dwData["DEVNAME"] = ZLAN2.GetDevName(hDEV);
            dwData["DESTNAME"] = ZLAN2.GetDestName(hDEV);
            dwData["LOCALIP"] = ZLAN2.GetIP(hDEV);
            dwData["NETMASK"] = ZLAN2.GetNetMask(hDEV);
            dwData["GATEWAY"] = ZLAN2.GetGateWay(hDEV);

            dwData["WORKMODE"] = ZLAN2.GetWorkMode(hDEV);
            dwData["DESTPORT"] = ZLAN2.GetDestPort(hDEV);
            dwData["BAUDRATEINDEX"] = ZLAN2.GetBaudrateIndex(hDEV);
            dwData["PARITY"] = ZLAN2.GetParity(hDEV);
            dwData["DATABITS"] = ZLAN2.GetDataBits(hDEV);
            dwData["STOPBITS"] = ZLAN2.GetStatus(hDEV);
            dwData["FLOWCONTROL"] = ZLAN2.GetFlowControl(hDEV);
            dwData["MAXPACKETLEN"] = ZLAN2.GetDevName(hDEV);
            dwData["MAXTIMEGAP"] = ZLAN2.GetDevName(hDEV);
            dwData["APPPROTOCOL"] = ZLAN2.GetDevName(hDEV);
            dwData["RECONNECTTIME"] = ZLAN2.GetDevName(hDEV);
            dwData["STATUS"] = ZLAN2.GetStatus(hDEV);

            dwData["RESOURCEPORT"] = ZLAN2.GetDevName(hDEV);
            dwData["VER"] = ZLAN2.GetDevName(hDEV);
            dwData["FUNCSEL"] = ZLAN2.GetDevName(hDEV);
            dwData["FUNCSEL2"] = ZLAN2.GetDevName(hDEV);
            UZLAN01(dwData);
        }

        public void ADDZLAN(string ip)
        { 
            dwData = TBMain.NewRow();
            SetUpNewRow(ref dwData);
            dwData["ABAID"] = VSDDAT.SD22.GETNEXT("0022", "ZL", "  ", 1);
            dwData["LOCALIP"] = ip;
            DZLAN02(dwData);
            TBMain.Rows.InsertAt(dwData, 0);
            InsertICC_ZLAN(dwData); 
            VAM.CHKZLAM(ip);
        }
        public void LOADZLAN(string ip)
        {
            if (ip.Length < 3)
                return;
            dwData = TBMain.NewRow();
            dwData["MANDANT"] = app.Mandant;
            dwData["LOCALIP"] = " AND TRIM(LOCALIP)='" + ip.Trim() + "'";
            SResult = QICC_ZLAN05(dwData);
            MergeData(SResult, false);
            if (SResult.Tables[0].Rows.Count > 0)
                return;
            dwData = TBMain.NewRow();
            dwData["MANDANT"] = app.Mandant;
            dwData["LOCALIP"] =   ip.Trim()  ;
            SResult = QICC_ZLAN04(dwData);
            if (SResult.Tables[0].Rows.Count > 0)
            {
                Helpers.LogHelper.info("ZLANServer:" + "Please set up the ZLAN device."); 
                return;
            } 
        } 
        public DataSet ZLAUTOREAD(string ip)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT AMEMANDANT||AMENRKRS||AMELFDNR||AMEPOS||AMEMODNR||AMEEINSTNR AS BDEKEY,AMEINTERVAL*0.001 AS INTERVAL,AMEBEZ AS BDEDES,SUBSTR(SDDATEN,2,10) AS DEVTYP,SUBSTR(SDDATEN,52,10) METHOD, E.* FROM "
                + " AMEINST E JOIN AMSTAMM M ON M.AMMANDANT = AMEMANDANT AND M.AMNRKRS = AMENRKRS AND AMLFDNR = AMELFDNR AND M.AMPOS = AMEPOS"
                + " JOIN SDDAT ON SDSA='0706' AND SUBSTR(SDKEY,3,2)=AMEMESCHL AND  SUBSTR(SDKEY,0,2)=AMEMANDANT"
                + " WHERE E.AMEMANDANT = '00' AND RTRIM(AMHERST)='" + ip+"' ORDER BY 1";
            SResult = Connect2Proxy(or1);
            return SResult; 
        }
        public DataSet CNTAUTOLISTEN(string machineid)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT AMEMANDANT||AMENRKRS||AMELFDNR||AMEPOS||AMEMODNR||AMEEINSTNR AS BDEKEY,AMEINTERVAL*0.001 AS INTERVAL ,AMEBEZ AS BDEDES, E.* FROM "
                + " AMEINST E JOIN AMSTAMM M ON M.AMMANDANT = AMEMANDANT AND M.AMNRKRS = AMENRKRS AND AMLFDNR = AMELFDNR AND M.AMPOS = AMEPOS"
                + " WHERE E.AMEMANDANT = '00' AND AMENRKRS||AMELFDNR||AMEPOS='" + machineid + "' ORDER BY 1";
            SResult = Connect2Proxy(or1);
            return SResult;
        }
    }
    public partial class VICC_ZLAN
    {
        
        public string ZLANSVRSTATUS
        {
            get;
            set;
        }
        public string MANDANT { get { if (dwMaster == null) return ""; return dwMaster["MANDANT"].ToString(); } set { if (dwMaster == null) return; dwMaster["MANDANT"] = value; OnPropertyChanged("MANDANT", value); } } //lENGth 2
        public double ABAID { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["ABAID"].ToString()); } set { if (dwMaster == null) return; dwMaster["ABAID"] = value; OnPropertyChanged("ABAID", value); } } //lENGth 0
        public double HDEV { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["HDEV"].ToString()); } set { if (dwMaster == null) return; dwMaster["HDEV"] = value; OnPropertyChanged("HDEV", value); } } //lENGth 0
        public string DEVTYP { get { if (dwMaster == null) return ""; return dwMaster["DEVTYP"].ToString(); } set { if (dwMaster == null) return; dwMaster["DEVTYP"] = value; OnPropertyChanged("DEVTYP", value); } } //lENGth 20
        public string MACHINEID { get { if (dwMaster == null) return ""; return dwMaster["MACHINEID"].ToString(); } set { if (dwMaster == null) return; dwMaster["MACHINEID"] = value; OnPropertyChanged("MACHINEID", value); } } //lENGth 20
        public string PDAID { get { if (dwMaster == null) return ""; return dwMaster["PDAID"].ToString(); } set { if (dwMaster == null) return; dwMaster["PDAID"] = value; OnPropertyChanged("PDAID", value); } } //lENGth 20
        public string WHLOCATION { get { if (dwMaster == null) return ""; return dwMaster["WHLOCATION"].ToString(); } set { if (dwMaster == null) return; dwMaster["WHLOCATION"] = value; OnPropertyChanged("WHLOCATION", value); } } //lENGth 20
        public string ITEMID { get { if (dwMaster == null) return ""; return dwMaster["ITEMID"].ToString(); } set { if (dwMaster == null) return; dwMaster["ITEMID"] = value; OnPropertyChanged("ITEMID", value); } } //lENGth 20
        public string DEVNAME { get { if (dwMaster == null) return ""; return dwMaster["DEVNAME"].ToString(); } set { if (dwMaster == null) return; dwMaster["DEVNAME"] = value; OnPropertyChanged("DEVNAME", value); } } //lENGth 30
        public string IPMODE { get { if (dwMaster == null) return ""; return dwMaster["IPMODE"].ToString(); } set { if (dwMaster == null) return; dwMaster["IPMODE"] = value; OnPropertyChanged("IPMODE", value); } } //lENGth 1
        public string LOCALIP { get { if (dwMaster == null) return ""; return dwMaster["LOCALIP"].ToString(); } set { if (dwMaster == null) return; dwMaster["LOCALIP"] = value; OnPropertyChanged("LOCALIP", value); } } //lENGth 20
        public double LOCALPORT { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["LOCALPORT"].ToString()); } set { if (dwMaster == null) return; dwMaster["LOCALPORT"] = value; OnPropertyChanged("LOCALPORT", value); } } //lENGth 0
        public string NETMASK { get { if (dwMaster == null) return ""; return dwMaster["NETMASK"].ToString(); } set { if (dwMaster == null) return; dwMaster["NETMASK"] = value; OnPropertyChanged("NETMASK", value); } } //lENGth 20
        public string GATEWAY { get { if (dwMaster == null) return ""; return dwMaster["GATEWAY"].ToString(); } set { if (dwMaster == null) return; dwMaster["GATEWAY"] = value; OnPropertyChanged("GATEWAY", value); } } //lENGth 20
        public string DNSSERVERIP { get { if (dwMaster == null) return ""; return dwMaster["DNSSERVERIP"].ToString(); } set { if (dwMaster == null) return; dwMaster["DNSSERVERIP"] = value; OnPropertyChanged("DNSSERVERIP", value); } } //lENGth 20
        public double WORKMODE { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["WORKMODE"].ToString()); } set { if (dwMaster == null) return; dwMaster["WORKMODE"] = value; OnPropertyChanged("WORKMODE", value); } } //lENGth 0
        public double DESTMODE { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["DESTMODE"].ToString()); } set { if (dwMaster == null) return; dwMaster["DESTMODE"] = value; OnPropertyChanged("DESTMODE", value); } } //lENGth 0
        public string SERVERIP { get { if (dwMaster == null) return ""; return dwMaster["SERVERIP"].ToString(); } set { if (dwMaster == null) return; dwMaster["SERVERIP"] = value; OnPropertyChanged("SERVERIP", value); } } //lENGth 20
        public string SERVRENAME { get { if (dwMaster == null) return ""; return dwMaster["SERVRENAME"].ToString(); } set { if (dwMaster == null) return; dwMaster["SERVRENAME"] = value; OnPropertyChanged("SERVRENAME", value); } } //lENGth 30
        public double SERVERPORT { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["SERVERPORT"].ToString()); } set { if (dwMaster == null) return; dwMaster["SERVERPORT"] = value; OnPropertyChanged("SERVERPORT", value); } } //lENGth 0
        public double BAUDRATEINDEX { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["BAUDRATEINDEX"].ToString()); } set { if (dwMaster == null) return; dwMaster["BAUDRATEINDEX"] = value; OnPropertyChanged("BAUDRATEINDEX", value); } } //lENGth 0
        public double PARITY { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["PARITY"].ToString()); } set { if (dwMaster == null) return; dwMaster["PARITY"] = value; OnPropertyChanged("PARITY", value); } } //lENGth 0
        public double DATABITS { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["DATABITS"].ToString()); } set { if (dwMaster == null) return; dwMaster["DATABITS"] = value; OnPropertyChanged("DATABITS", value); } } //lENGth 0
        public double STOPBITS { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["STOPBITS"].ToString()); } set { if (dwMaster == null) return; dwMaster["STOPBITS"] = value; OnPropertyChanged("STOPBITS", value); } } //lENGth 0
        public double FLOWCONTROL { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["FLOWCONTROL"].ToString()); } set { if (dwMaster == null) return; dwMaster["FLOWCONTROL"] = value; OnPropertyChanged("FLOWCONTROL", value); } } //lENGth 0
        public double MAXPACKETLEN { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["MAXPACKETLEN"].ToString()); } set { if (dwMaster == null) return; dwMaster["MAXPACKETLEN"] = value; OnPropertyChanged("MAXPACKETLEN", value); } } //lENGth 0
        public double MAXTIMEGAP { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["MAXTIMEGAP"].ToString()); } set { if (dwMaster == null) return; dwMaster["MAXTIMEGAP"] = value; OnPropertyChanged("MAXTIMEGAP", value); } } //lENGth 0
        public double APPPROTOCOL { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["APPPROTOCOL"].ToString()); } set { if (dwMaster == null) return; dwMaster["APPPROTOCOL"] = value; OnPropertyChanged("APPPROTOCOL", value); } } //lENGth 0
        public double RECONNECTTIME { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["RECONNECTTIME"].ToString()); } set { if (dwMaster == null) return; dwMaster["RECONNECTTIME"] = value; OnPropertyChanged("RECONNECTTIME", value); } } //lENGth 0
        public double KEEPALIVETIME { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["KEEPALIVETIME"].ToString()); } set { if (dwMaster == null) return; dwMaster["KEEPALIVETIME"] = value; OnPropertyChanged("KEEPALIVETIME", value); } } //lENGth 0
        public double WEBPORT { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["WEBPORT"].ToString()); } set { if (dwMaster == null) return; dwMaster["WEBPORT"] = value; OnPropertyChanged("WEBPORT", value); } } //lENGth 0
        public double STATUS { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["STATUS"].ToString()); } set { if (dwMaster == null) return; dwMaster["STATUS"] = value; OnPropertyChanged("STATUS", value); } } //lENGth 0
        public string RESOURCEIP { get { if (dwMaster == null) return ""; return dwMaster["RESOURCEIP"].ToString(); } set { if (dwMaster == null) return; dwMaster["RESOURCEIP"] = value; OnPropertyChanged("RESOURCEIP", value); } } //lENGth 20
        public double RESOURCEPORT { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["RESOURCEPORT"].ToString()); } set { if (dwMaster == null) return; dwMaster["RESOURCEPORT"] = value; OnPropertyChanged("RESOURCEPORT", value); } } //lENGth 0
        public string VER { get { if (dwMaster == null) return ""; return dwMaster["VER"].ToString(); } set { if (dwMaster == null) return; dwMaster["VER"] = value; OnPropertyChanged("VER", value); } } //lENGth 20
        public string FUNCSEL { get { if (dwMaster == null) return ""; return dwMaster["FUNCSEL"].ToString(); } set { if (dwMaster == null) return; dwMaster["FUNCSEL"] = value; OnPropertyChanged("FUNCSEL", value); } } //lENGth 20
        public string FUNCSEL2 { get { if (dwMaster == null) return ""; return dwMaster["FUNCSEL2"].ToString(); } set { if (dwMaster == null) return; dwMaster["FUNCSEL2"] = value; OnPropertyChanged("FUNCSEL2", value); } } //lENGth 20
        public string UDPGROUPIP { get { if (dwMaster == null) return ""; return dwMaster["UDPGROUPIP"].ToString(); } set { if (dwMaster == null) return; dwMaster["UDPGROUPIP"] = value; OnPropertyChanged("UDPGROUPIP", value); } } //lENGth 16
        public string DEVID { get { if (dwMaster == null) return ""; return dwMaster["DEVID"].ToString(); } set { if (dwMaster == null) return; dwMaster["DEVID"] = value; OnPropertyChanged("DEVID", value); } } //lENGth 20
        public string IO { get { if (dwMaster == null) return ""; return dwMaster["IO"].ToString(); } set { if (dwMaster == null) return; dwMaster["IO"] = value; OnPropertyChanged("IO", value); } } //lENGth 1
        public double FUNCEN { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["FUNCEN"].ToString()); } set { if (dwMaster == null) return; dwMaster["FUNCEN"] = value; OnPropertyChanged("FUNCEN", value); } } //lENGth 0
        public double SERVERMODEPARAMT { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["SERVERMODEPARAMT"].ToString()); } set { if (dwMaster == null) return; dwMaster["SERVERMODEPARAMT"] = value; OnPropertyChanged("SERVERMODEPARAMT", value); } } //lENGth 0
        public string ZP0 { get { if (dwMaster == null) return ""; return dwMaster["ZP0"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP0"] = value; OnPropertyChanged("ZP0", value); } } //lENGth 20
        public string ZP1 { get { if (dwMaster == null) return ""; return dwMaster["ZP1"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP1"] = value; OnPropertyChanged("ZP1", value); } } //lENGth 20
        public string ZP2 { get { if (dwMaster == null) return ""; return dwMaster["ZP2"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP2"] = value; OnPropertyChanged("ZP2", value); } } //lENGth 20
        public string ZP3 { get { if (dwMaster == null) return ""; return dwMaster["ZP3"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP3"] = value; OnPropertyChanged("ZP3", value); } } //lENGth 20
        public string ZP4 { get { if (dwMaster == null) return ""; return dwMaster["ZP4"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP4"] = value; OnPropertyChanged("ZP4", value); } } //lENGth 20
        public string ZP5 { get { if (dwMaster == null) return ""; return dwMaster["ZP5"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP5"] = value; OnPropertyChanged("ZP5", value); } } //lENGth 20
        public string ZP6 { get { if (dwMaster == null) return ""; return dwMaster["ZP6"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP6"] = value; OnPropertyChanged("ZP6", value); } } //lENGth 20
        public string ZP7 { get { if (dwMaster == null) return ""; return dwMaster["ZP7"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP7"] = value; OnPropertyChanged("ZP7", value); } } //lENGth 20
        public string ZP8 { get { if (dwMaster == null) return ""; return dwMaster["ZP8"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP8"] = value; OnPropertyChanged("ZP8", value); } } //lENGth 20
        public string ZP9 { get { if (dwMaster == null) return ""; return dwMaster["ZP9"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP9"] = value; OnPropertyChanged("ZP9", value); } } //lENGth 20
        public string ZP10 { get { if (dwMaster == null) return ""; return dwMaster["ZP10"].ToString(); } set { if (dwMaster == null) return; dwMaster["ZP10"] = value; OnPropertyChanged("ZP10", value); } } //lENGth 200
        public string DATASEND { get { if (dwMaster == null) return ""; return dwMaster["DATASEND"].ToString(); } set { if (dwMaster == null) return; dwMaster["DATASEND"] = value; OnPropertyChanged("DATASEND", value); } } //lENGth 400
        public string NEWUSER { get { if (dwMaster == null) return ""; return dwMaster["NEWUSER"].ToString(); } set { if (dwMaster == null) return; dwMaster["NEWUSER"] = value; OnPropertyChanged("NEWUSER", value); } } //lENGth 8
        public string NEWDATE { get { if (dwMaster == null) return ""; return dwMaster["NEWDATE"].ToString(); } set { if (dwMaster == null) return; dwMaster["NEWDATE"] = value; OnPropertyChanged("NEWDATE", value); } } //lENGth 8
        public string CHGUSER { get { if (dwMaster == null) return ""; return dwMaster["CHGUSER"].ToString(); } set { if (dwMaster == null) return; dwMaster["CHGUSER"] = value; OnPropertyChanged("CHGUSER", value); } } //lENGth 8
        public string CHGDATE { get { if (dwMaster == null) return ""; return dwMaster["CHGDATE"].ToString(); } set { if (dwMaster == null) return; dwMaster["CHGDATE"] = value; OnPropertyChanged("CHGDATE", value); } } //lENGth 8

    }
}
